<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>对象处理class属性</title>
    <style>
        .active {
            width: 50px;
            height: 50px;
            border: 1px solid pink
        }

        .error {
            background-color: yellow;
        }
    </style>
</head>

<body>
    <div class="app">
        <div :class="{active: isActive,error: isError}">我是盒子</div>
        <button @click="handle">切换</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        var xm = new Vue({
            el: '.app',
            data: {
                isActive: true,
                isError: true
            },
            methods: {
                handle() {
                    this.isError = !this.isError
                }
            }

        })

    </script>
</body>

</html>